 <?php if($_SESSION['Permit']==1)
 { 
 	$page = isset($_GET["page"])? $_GET["page"] : 1;
 	$sql = "Select id, name, email, phone, title, readed from tblMessage order by id desc LIMIT ";
 } 
 else
 { 
 	//xử lý sau

 }   

?>
  <script type="text/javascript">
  
  function Delete()
  {	  
  		var answer = confirm ("Bạn có chắc là muốn xóa những mục đã chọn?");
		if (answer)
		{
			document.mylist.submit();
		}
  }

  function checkAll(control)
	{
		field= document.getElementsByName('cid[]');
		if(control.checked)
{ 
		for (i = 0; i < field.length; i++)
		field[i].checked = true ;
	}

else

for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}




 </script>    
   

   <div align="center" style="padding:10 10 10 10; border:1px black solid;">
    <form name="mylist" action="message/delete.php" method="post"> 
  <table>
  	<tr>
    	<td colspan="4"><h3>Quản lý thông tin liên hệ</h3></td>
        <td colspan="2" align="right">
        	<a  style="margin-right:15px;" title="Xóa mục đã chọn" onclick="Delete()"><img src="img/delete.png" width="32" height="32"/></a>
        </td>
    </tr>
    
    
  
    <tr bgcolor="#008000" style="color:white; height:30px;">
      <th width="5%" align="center"><input type="checkbox" name="toggle"  id="toggle" onclick=" checkAll(this);" /></th>
      <th width="25%" >Người gửi</th>
      <th width="25%" >Email</th>
      <th width="20%" >Điện thoại  </th>
      <th width="20%" >Tiêu đề</th>
      <th width="5%">Đã đọc</th>
       
    </tr>
   
    <?php  $i=0;
	foreach($menuSortedArray as $row)
	{
	?>
     <tr  bgcolor="<?php if($i%2!=0) echo '#f6f8db';else echo  '#9ff1a1'?>" onmouseover="changeback(this);" onmouseout="changebre(this);">
    	  <td align="center"><input type="checkbox" name="cid[]" value="<?php echo $row->id?>" /></td>
         <td ><a href="menue&id=<?php echo $row->id?>"><?php echo $row->vi_name;?></a></td>
         <td ><a href="menue&id=<?php echo $row->id?>"><?php echo $row->en_name;?></a></td>
         <td ><?php echo $row->url; ?></td>
    	 <td ><?php echo $row->order; ?></td>
    	 <td><?php echo ($row->featured ==1) ? "Có" : "Không";?>
	
    <?php
    $i++;
	}
	?>
 
      
   </table>
   </form> 
</div>
